<?php
/*=============================================================================
|| ##################################################################
||	phpFoX Konsort
|| ##################################################################
||	
||	Copyright		: (C) 2005-2007 PHPFOX Limited a Reality Fox Creation
||	Contact			: info@phpfox.com
||
||	- phpFoX and all of its source code and files are protected by Copyright Laws. 
||
||	- The license for phpFoX permits you to install this software on a single domain (.com, .org, .net, etc.). 
||
||	- You may also not remove this copyright screen which shows the copyright information and credits for phpFoX (RealityFOX Creations). 
||
||	- phpFoX Konsort is NOT a FREE software - http://www.phpfox.com/license/
||
|| ##################################################################
=============================================================================*/

/* $File: ./include/modules/Groups/classes/PhpFox_ComponentGroupViewGalleryPhotos.class.php, $Author:  $ */



/** Component for photo list on the group view page
 * @version $Id: PhpFox_ComponentGroupViewMemberList.class.php 
 *  Max Kovrigovich
 * @package module.groups
 */
class PhpFox_Mod_Groups_ComponentGroupViewGalleryPhotos extends BaseComponent
{
    /** Processing method
     */
    
    function process()
    {
        //check permissions
        $oSecurityService = App::getModuleService('Account', 'Security');
		/* @var $oSecurityService PhpFox_Mod_Account_ServiceSecurity */
		$oSecurityService->checkPerm('groups', array('read_only', 'full')); 

        $oGroupsGalleryService = $this->_oModule->getService('Gallery');
        /* @var $oGroupsGalleryService PhpFox_Mod_Groups_ServiceGallery */
        
        $oReq = &App::getRequest();
        /* @var $oReq Request */
        
        $oTpl = $this->_oModule->getTemplate();
        
        $iGroupId = $oReq->get('id');
        
		if (App::getParam('bImageSecurity'))
		{
		   	App::clearAccessForContent('groups');
		}            

        list($iPhotoCnt, $aPhotos) = $oGroupsGalleryService->getImages($iGroupId, 1, 4, false);

        $bShowOffStatus  = 1;
        $oTpl->assign(array(
            'iGroupId'  => $iGroupId,
            'aPhotos'	=> $aPhotos,
            'iPhotoCnt' => $iPhotoCnt,
	        'sImageUrl' => App::getParam('groups.pic.url'), 
        ));
        $sHtml = $oTpl->fetch('GroupViewGalleryPhotos.html');
        return $sHtml;
    }
}
?>